package com.miracle.java2110.controller;


import com.miracle.java2110.common.PageVo;
import com.miracle.java2110.common.R;
import com.miracle.java2110.pojo.Vacation;
import com.miracle.java2110.service.VacationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/vacation")
@CrossOrigin("*")
public class VacationController {

    @Autowired
    private VacationService vacationService;

    @RequestMapping("/list")
    public List<Vacation> findVacation() {
        return vacationService.findVacation();
    }

    @RequestMapping("/pageData")
    public PageVo<Vacation> getPageData(@RequestParam Map<String, Object> params) {
        return vacationService.getPageData(params);
    }

    @RequestMapping("/add")
    public R addVacation(Vacation vacation) {
        return vacationService.addVacation(vacation);
    }

    @RequestMapping("/delete")
    public R deleteById(Integer id) {
        return vacationService.deleteById(id);
    }

    @RequestMapping("/update")
    public R updateById(Vacation vacation) {
        return vacationService.updateById(vacation);
    }


}
